/**
 * 
 */
package co.fitstart.mobile.service;

import java.util.Date;
import java.util.List;

import com.demo2do.core.service.GenericService;

import co.fitstart.entity.course.round.CourseRound;
import co.fitstart.entity.user.Student;
import co.fitstart.entity.user.User;
import co.fitstart.entity.user.UserAccount;
import co.fitstart.entity.user.WechatAccount;
import co.fitstart.entity.user.bwh.BwhRecord;
import co.fitstart.entity.user.inbody.InbodyRecord;

/**
 * @author downpour
 * @author lute
 * @author mohanlan
 */
public interface UserService extends GenericService<User> {
    
    /**
     * 
     * @param mobile
     * @return
     */
    public User getUser(String mobile);
    
    /**
     * Get user by WeChat openid
     * 
     * @param openid
     * @return
     */
    public User getUserByOpenId(String openid);
    
    /**
     * 
     * @param user
     * @return
     */
    public Student getStudent(User user);
    
    /**
     * 
     * @param code
     * @return
     */
    public Student getStudent(String code);
    
    /**
     * 
     * @param name
     * @param value
     * @return 
     */
    public UserAccount getUserAccount(String name, String value);
    
    /**
     * create user account
     * 
     * @param userAccount
     * @param wechatAccount
     */
    public void createUserAccount(UserAccount userAccount, WechatAccount wechatAccount);
    
    /**
     * 
     * @param mobile
     * @param openid
     * @param accountId
     * @param isEmail
     * @return
     */
    public UserAccount login(String mobile, String openid, String accountId, boolean isEmail);
    
    /**
     * Edit user region
     * 
     * @param user
     * @param country
     * @param pcd --- province city district
     */
    public void editRegion(User user, String country, String pcd);
    
    /**
     * Edit user address
     * 
     * @param user
     * @param address
     */
    public void editAddress(User user, String address);

    /**
     * Get latest effective date 
     * @param user
     * @return
     */
    public Date latestEffectiveDate(User user);

    /**
     * 
     * @param user
     * @return
     */
    public InbodyRecord getLatestInbodyRecord(User user);
    
    
    /**
     * 
     * @param user
     * @return
     */
    public List<InbodyRecord> listInbodyRecord(User user);
    
    /**
     * list inbody record by user and courseRound
     * 
     * @param user
     * @param courseRound
     * @return
     */
    public List<InbodyRecord> listInbodyRecoreds(User user, CourseRound courseRound);

    /**
     * list bwh record by user and courseRound
     * 
     * @param user
     * @param courseRound
     * @return
     */
    public List<BwhRecord> listBwhRecords(User user, CourseRound courseRound);

}
